package mbms.mobilebudget.exchangerateservice;

import java.util.List;

import mbms.mobilebudget.OperationsActivity;
import mbms.mobilebudget.entity.CurrencyRate;
import android.os.AsyncTask;

public class CurrencyRateRequestTask extends AsyncTask<String, String, List<CurrencyRate>>{
	
	private OperationsActivity operationsActivity;

	public CurrencyRateRequestTask(OperationsActivity operationsActivity) {
		this.operationsActivity = operationsActivity;
	}
	
    @Override
    protected List<CurrencyRate> doInBackground(String... uri) {
    	CurrencyRateParser parser = new CurrencyRateParser();
    	
    	return parser.parseCurrencyRates(uri[0]);
    }

    @Override
    protected void onPostExecute(List<CurrencyRate> currencyRateList) {
    	operationsActivity.updateCurrencyRates(currencyRateList);
    }
	
}
